<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2018/4/22
 * Time: 13:11
 */
/**
 * 统一返回信息
 * @param $code
 * @param $data
 * @param $msge
 */
function msg($code, $data, $msg)
{
    return compact('code', 'data', 'msg');
}

/**
 * 生成操作按钮
 * @param array $operate 操作按钮数组
 */
function showOperate($operate = [])
{
    if(empty($operate)){
        return '';
    }

    $option = '';
    foreach($operate as $key=>$vo){
        $option .= ' <a href="' . $vo['href'] . '"><button type="button" class="btn btn-' . $vo['btnStyle'] . ' btn-sm">'.
            '<i class="' . $vo['icon'] . '"></i> ' . $key . '</button></a>';
    }

    return $option;
}
